home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 23 / 023.d81 / t.56 sprites < prev    next >
Text File  |  2022-08-26  |  3KB  |  190 lines

  1.  
  2.  
  3.             56 SPRITES
  4.                by
  5.           Jonathan Rodda
  6.  
  7. COMMODORE POWER/PLAY MAGAZINE
  8. April/May, 1986
  9. p.97
  10.  
  11.   Computer programmers are, by
  12.  
  13. nature, a bunch of showoffs.  In
  14.  
  15. fact, sometimes the only way to get
  16.  
  17. them going is to tell them that
  18.  
  19. something is impossible.  Then watch
  20.  
  21. out-- they will eat their disk
  22.  
  23. libraries before they throw in the
  24.  
  25. towel.
  26.  
  27.  
  28.   Take sprites, for example.
  29.  
  30. Everyone knows that you cannot have
  31.  
  32. more than eight sprites on the screen
  33.  
  34. at a time.  End of argument.  Even
  35.  
  36. programmers cannot change that law.
  37.  
  38.  
  39.   But with almost every rule, there
  40.  
  41. is an exception.  56 Sprites is an
  42.  
  43. example of just such an exception.
  44.  
  45.  
  46.   One of the most powerful features
  47.  
  48. of the Commodore 64 is the raster
  49.  
  50. interrupt.  By using raster
  51.  
  52. interrupts, for example, you can
  53.  
  54. display several background colors on
  55.  
  56. the screen, or display graphics and
  57.  
  58. text on the same screen.
  59.  
  60.  
  61.   Or, as 56 SPRITES demonstrates, you
  62.  
  63. can have more than the usual eight
  64.  
  65. sprites on the screen.
  66.  
  67.  
  68.   But quick-- what exactly is a
  69.  
  70. "raster interrupt"?  Forget the
  71.  
  72. interrupt-- what is a "raster"?
  73.  
  74.  
  75.   Everything centers around how
  76.  
  77. pictures are displayed on the the
  78.  
  79. monitor.  The picture tube consists
  80.  
  81. of an electron gun on one end and a
  82.  
  83. screen on the other.  The screen is
  84.  
  85. filled with rows of phosphor dots
  86.  
  87. that glow when they are struck by an
  88.  
  89. electron.  These dots are called
  90.  
  91. "pixels"; a horizontal row of pixels
  92.  
  93. is called a raster.
  94.  
  95.  
  96.   When the picture signal is fed to
  97.  
  98. the electron gun, it scans each
  99.  
  100. raster from left to right, activating
  101.  
  102. the pixels as determined by the
  103.  
  104. signal.  After one raster has been
  105.  
  106. scanned, the beam drops to the next
  107.  
  108. line.
  109.  
  110.  
  111.   The picture is redrawn sixty times
  112.  
  113. per second.  This drawing process,
  114.  
  115. however, can be stopped for a moment
  116.  
  117. with a raster interrupt.  During the
  118.  
  119. time that the drawing process is
  120.  
  121. halted, another operation can be
  122.  
  123. performed.  Then the drawing process
  124.  
  125. continues where it left off.
  126.  
  127.  
  128.   Because pixels continue to glow for
  129.  
  130. a moment after being excited by an
  131.  
  132. electron, images generated during
  133.  
  134. the raster interrupt can appear to
  135.  
  136. exist simultaneously on the screen
  137.  
  138. when in fact you are seeing their
  139.  
  140. afterimages.
  141.  
  142.  
  143.   For example, the seven rows of
  144.  
  145. eight sprites you will see when you
  146.  
  147. run 56 SPRITES seem to occur all at
  148.  
  149. once on the screen.
  150.  
  151.  
  152.   Actually, there is only one row of
  153.  
  154. sprites which is redrawn in a
  155.  
  156. different part of the screen at every
  157.  
  158. screen update (once every 60
  159.  
  160. seconds).  Because of the speed of
  161.  
  162. the update and the tendency of pixels
  163.  
  164. to hold an afterimage, there seem
  165.  
  166. to be 56 sprites on the screen.
  167.  
  168.  
  169.   To learn more about the ins and
  170.  
  171. outs of raster interrupts, refer to
  172.  
  173. Rodda's article in the Commodore
  174.  
  175. magazine cited above.
  176.  
  177. NOTE: Because of the nature of this
  178. program, it can not be run from the
  179. Loadstar environment.  To run 56
  180. Sprites, exit Loadstar, type
  181. LOAD"56 SPRITES",8 <RETURN> and
  182. RUN <RETURN>.
  183.  
  184. FILES REQUIRED:
  185.  
  186. 56 SPRITES
  187.  
  188. ----------<end of text>-------------
  189.  
  190.